home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Sound / MUImp3 / MUImp3.mmp < prev    next >
Text File  |  2000-05-04  |  10KB  |  460 lines

  1. /* */
  2.  
  3. parse arg name
  4. options results
  5.  
  6. address command
  7. 'stack 50000'
  8.  
  9. if ~show('L',"rexxtricks.library") then call addlib('rexxtricks.library',0,-30,0)
  10.  
  11. option = word(name,1)
  12. target = substr(name,length(option)+2)
  13. prefs = 'envarc:MUImp3.prefs'
  14. sorted = -2
  15. TRUE = 1
  16. FALSE = 0
  17.  
  18. if option = "GENRE" then do
  19.  address MUImp3
  20.  nr = value(word(target,1))
  21.  popslider id mpg attrs 0x8042ae3a nr
  22.  address command
  23.  'rx MUImp3.mmp CHAN 6'||nr
  24.  exit
  25. end
  26.  
  27. if option = "DISABLE" THEN DO
  28.  ADDRESS MUImp3
  29.  GROUP id BUTT ATTRS 0x80423661 TARGET
  30.  exit
  31. end
  32.  
  33. if option="ATTOF" then do
  34. address MUImp3
  35. list id song attrs 0x80421654
  36. nr = result
  37. list id song
  38. temp = maketemp('t:')
  39. call open('work',temp,'W')
  40. do a = 0 to nr-1
  41. address MUImp3
  42. list id song pos a
  43. line = result
  44. list id song
  45. if left(line,2)="ID" then call writeln('work','rx MUImp3.mmp TTOF' line)
  46. end
  47. call close('work')
  48. address command
  49. 'execute' temp
  50. 'delete >nil:' temp
  51. exit
  52. end
  53.  
  54.  
  55. if option="TTOF" then do
  56.  address MUImp3
  57.  l = target
  58.  if target = "" then do
  59.  list id song
  60.  l = result
  61.  list id song
  62.  end
  63.  if left(l,4)="FILE" then do
  64.   text id mes3 label "No CD-Track"
  65.   exit
  66.  end
  67.  call readfile(prefs,targ)
  68.  call readfile(makepath('projects',l),file)
  69.  temp = maketemp(targ.11)
  70.  nr = value(right(l,2))
  71.  com1 = 'cdda mute' targ.3 'track' nr 'file' temp
  72.  address command
  73.  'rx MUImp3.mmp MESSAGE Read Track' nr
  74.  'rx MUImp3.mmp DISABLE 1'
  75.  com1
  76.  'rx MUImp3.mmp ADDFILE' temp
  77.  call readfile(makepath('projects','FILE_'||filepart(temp)),line)
  78.  do a = 1 to 7
  79.   line.a = file.a
  80.  end
  81.  line.8 = temp
  82.  line.0 = 8
  83.  call writefile(makepath('projects','FILE_'||filepart(temp)),line)
  84.  address command
  85.  'rx MUImp3.mmp MESSAGE' Ready
  86.  'rx MUImp3.mmp REMOVE' l
  87.  'rx MUImp3.mmp DISABLE 0'
  88. exit
  89. end
  90.  
  91. if option="CONVALL" then do
  92. address MUImp3
  93. list id song attrs 0x80421654
  94. nr = result
  95. list id song
  96. temp = maketemp('t:')
  97. do a = 0 to nr-1
  98. address MUImp3
  99. list id song pos a
  100. b = a + 1
  101. line.b = result
  102. line.b = 'rx MUImp3.mmp CONVERT' line.b
  103. list id song
  104. end
  105. line.0 = nr
  106. call writefile(temp,line)
  107. address command
  108. 'execute' temp
  109. 'delete >nil:' temp
  110. exit
  111. end
  112.  
  113. if option="CONVERT" then do
  114.  address MUImp3
  115. if target = "" then do
  116.  list id song
  117.  l = result
  118.  list id song
  119. end
  120. else l = target
  121.  call readfile(prefs,line)
  122.  call readfile(makepath('projects',l),file)
  123.  com = line.4
  124.  if line.5 = 1 then com = com '-c'
  125.  if line.6 = 1 then com = com '-o'
  126.  if line.7 = 1 then com = com '-r'
  127.  if line.8 = 1 then com = com '-x'
  128.  com = com '-b' line.9
  129.  if line.10 ~= "Auto" then do
  130.   if line.10 = "Stereo" then com = com '-s'
  131.   else com = com '-m'
  132.  end
  133.  com = com '-t' '"'file.1'"'
  134.  com = com '-a' '"'file.2'"'
  135.  com = com '-l' '"'file.3'"'
  136.  com = com '-y' '"'file.4'"'
  137.  com = com '-e' '"'file.5'"'
  138.  com = com '-g' '"'file.6'"'
  139.  
  140.  nr = value(right(l,2))
  141.  temp2 = maketemp(line.11)
  142.  com1 = 'cdda mute' line.3 'track' nr 'file' temp2
  143.  temp = maketemp('t:')
  144.  call open('work',temp,'W')
  145.  if left(l,2)="ID" then do
  146.  com1 = 'run >nil: cdda mute' line.3 'track' nr 'file PIPE:MUImp3/500000/100'
  147.  com = com 'PIPE:MUImp3' '"'file.7'"'
  148.  call writeln('work','stack 500000')
  149.  call writeln('work','rx MUImp3.mmp MESSAGE Read Track '||nr)
  150.  call writeln('work',com1)
  151.  call writeln('work','rx MUImp3.mmp MESSAGE Convert Track '||nr)
  152.  call writeln('work',com)
  153.  call writeln('work','rx MUImp3.mmp SONGUP' l) 
  154.  call writeln('work','delete >nil:' temp2)
  155.  call writeln('work','rx MUImp3.mmp MESSAGE Ready')
  156.  end
  157.  else do
  158.  com = com '"'file.8'"' '"'file.7'"'
  159.  call writeln('work','stack 500000')
  160.  call writeln('work','rx MUImp3.mmp MESSAGE Convert File '||file.8)
  161.  call writeln('work',com)
  162.  if upper(right(file.8,4))=".TMP" then call writeln('work','delete >nil: '||file.8)
  163.  call writeln('work','rx MUImp3.mmp SONGUP' l)
  164.  call writeln('work','rx MUImp3.mmp MESSAGE Ready')
  165.  end
  166.  call close('work')
  167.  address command
  168.  'rx MUImp3.mmp DISABLE 1'
  169.  'execute >nil:' temp
  170.  'delete >nil:' temp
  171.  'delete >nil:' temp2
  172.  'rx MUImp3.mmp DISABLE 0'
  173. exit
  174. end
  175.  
  176. if option="MESSAGE" then do
  177. address MUImp3
  178. text id mes3 label target
  179. exit
  180. end
  181.  
  182. if option="SONGUP" then do
  183. address command
  184. 'delete >nil:' makepath('projects',target)
  185. address MUImp3
  186. list id song remove string target
  187. list id song
  188. exit
  189. end
  190.  
  191. if option="REMOVE" then do
  192. line = target
  193. address MUImp3
  194. if target="" then do
  195.  list id song
  196.  line = result
  197. end
  198. if line = "" then exit
  199. list id song remove string line
  200. list id song
  201. address command
  202. 'delete >nil:' makepath('projects',line)
  203. exit
  204. end
  205.  
  206. if option="SHOWINFO" then do
  207.  call readfile(makepath('projects',target),line)
  208.  address MUImp3
  209.  text id mes2 label target
  210.  string id mpt content line.1
  211.  string id mpr content line.2
  212.  string id mpa content line.3
  213.  string id mpy content line.4
  214.  string id mpe content line.5
  215.  popslider id mpg attrs 0x8042ae3a line.6 
  216. exit
  217. end
  218.  
  219. if option="ADDFILE" then do
  220.  address MUImp3
  221.  if target="" then do
  222.   text id mes3 label "Drop one AIFF-16Bit File on Projects-List"
  223.   exit
  224.  end
  225.  call readfile(prefs,targ)
  226.  line.0 = "FILE_"||filepart(target)
  227.  line.1 = filepart(target)
  228.  line.2 = ""
  229.  line.3 = ""
  230.  line.4 = right(date('N'),4)
  231.  line.5 = 'MUImp3' filepart(target)
  232.  line.6 = "13"
  233.  line.7 = makepath(targ.12,filepart(remsig(target)))
  234.  line.7 = makesuffix(line.7,'mp3',R)
  235.  line.8 = target
  236.  if ~exists('projects') then do
  237.   address command
  238.   'makedir >nil: projects'
  239.   address MUImp3
  240.  end
  241.  a = line.0
  242.  line.0 = 8
  243.  call writefile(makepath('projects',a),line)
  244.  list id song insert nodup pos sorted string a
  245.  list id song
  246. exit
  247. end
  248.  
  249.  
  250.  
  251. if option="ADDCD" then do
  252.  address MUImp3
  253.  text id mes1
  254.  cdid = result
  255.  if ~index(cdid,'ID') then do
  256.   address command 
  257.   'rx MUImp3.mmp GETID'
  258.   address MUImp3
  259.   text id mes1
  260.   cdid = result
  261.  end
  262.  call readfile(prefs,line)
  263.  slider id mint
  264.  min1 = result
  265.  slider id maxt
  266.  max1 = result 
  267.  if ~exists('projects') then do
  268.   address command
  269.   'makedir >nil: projects'
  270.   address MUImp3
  271.  end
  272.  do a = min1 to max1
  273.   file.0 = cdid||"-"||overlay(a,'00',3-length(a))
  274.   title0 = ""
  275.   title.1 = cdid
  276.   c = a + 2
  277.   title.c = file.0
  278.   say line.13||cdid
  279.   if exists(line.13||cdid) then do
  280.    call readfile(line.13||cdid,title)
  281.   end
  282.   file.1 = title.c
  283.   file.2 = title.1
  284.   file.3 = title.2
  285.   file.4 = ""
  286.   file.5 = 'MUImp3' file.0
  287.   file.6 = "13"
  288.   file.7 = makepath(line.12,remsig(file.1)||'.mp3')
  289.   f = file.0
  290.   file.8 = ""
  291.   file.0 = 8
  292.   call writefile('projects/'||f,file)
  293.   address MUImp3
  294.   list id song insert nodup pos sorted string f
  295.   list id song
  296.  end
  297. exit
  298. end
  299. if option="SCHECK" then do
  300.  address MUImp3
  301.  slider id mint
  302.  min1 = result
  303.  slider id maxt
  304.  max1 = result
  305.  if min1 > max1 then slider id maxt attrs 0x8042ae3a min1
  306.  if max1 < min1 then slider id mint attrs 0x8042ae3a max1
  307. exit
  308. end
  309. if option="GETID" then do
  310.  file = "ID"
  311.  temp = maketemp('t:')
  312.  call readfile(prefs,line)
  313.  address command
  314.  'cdda mute list' line.3 '>'||temp
  315.  call readfile(temp,track)
  316.  'delete >nil:' temp
  317.  nr = track.0 - 2
  318.  file = file||overlay(nr,'00',3-length(nr))||'0'
  319.  if nr > 1 then do 
  320.   file1 = d2x(value(word(track.2,6))+value(word(track.3,6)))
  321.  if word(track.2,2)>0 then file1 = d2x(value(word(track.2,6))+value(word(track.3,6)+value(word(track.2,2))))
  322.   if length(file1)<5 then file1=overlay(file1,'00000',6-length(file1))
  323.  end
  324.  else file1 = '00000'
  325.  file = file||file1||'0'
  326.  a = nr + 2
  327.  file1 = d2x(value(word(track.a,6)))
  328.  if word(track.2,2)>0 then file1 = d2x(value(word(track.2,2)+word(track.a,6)))
  329.  file = file||file1
  330.  address MUImp3
  331.  text id mes1 label file
  332.  slider id mint attrs 0x8042d78a nr 0x8042e404 1 0x8042ae3a 1
  333.  slider id maxt attrs 0x8042d78a nr 0x8042e404 1 0x8042ae3a nr
  334. exit
  335. end
  336.  
  337. if option="INIT" then do
  338.  if ~exists(prefs) then do
  339.   address MUImp3
  340.   cycle id bitr label "128"
  341.   address command
  342.   'rx MUImp3.mmp SAVE'
  343.  end
  344.  address command
  345.  'rx MUImp3.mmp LOAD'
  346.  temp = maketemp('t:')
  347.  if ~exists('projects') then 'makedir projects'
  348.  'list projects lformat %s >'||temp
  349.  call readfile(temp,line)
  350.  'delete >nil:' temp
  351.  address MUImp3
  352.  do a = 1 to line.0
  353.   list id song pos sorted insert nodup string line.a
  354.  end
  355.  call readfile('Genres',line)
  356.  do a = 1 to line.0
  357.   if line.a ~="" then do
  358.    line = value(substr(line.a,1,3)) substr(line.a,5)
  359.    list id genr pos sorted insert nodup string line
  360.   end
  361.  end
  362. exit
  363. end
  364.  
  365. if option="LOAD" then do
  366. call readfile(prefs,line)
  367. call setenv(CDDA_DEVICE,line.1)
  368. call setenv(CDDA_UNIT,line.2)
  369. address MUImp3
  370. string id cdev content line.1
  371. slider id cdun attrs 0x8042ae3a line.2 
  372. cycle id plan label line.3
  373. popasl id path content line.4
  374. check id copy attrs 0x8042654b line.5 
  375. check id orig attrs 0x8042654b line.6
  376. check id crc attrs 0x8042654b line.7
  377. check id max attrs 0x8042654b line.8
  378. cycle id bitr label line.9
  379. cycle id ster label line.10
  380. popasl id temp content line.11
  381. popasl id dest content line.12
  382. popasl id cdid content line.13
  383.  
  384. exit
  385. end
  386. if option="SAVE" then do
  387. address MUImp3
  388. string id cdev
  389. line.1 = result
  390. slider id cdun 
  391. line.2 = result
  392. cycle id plan
  393. line.3 = result
  394. popasl id path
  395. line.4 = result
  396. check id copy
  397. line.5 = result
  398. check id orig
  399. line.6 = result
  400. check id crc
  401. line.7 = result
  402. check id max
  403. line.8 = result
  404. cycle id bitr
  405. line.9 = result
  406. cycle id ster
  407. line.10 = result
  408. popasl id temp
  409. line.11 = result
  410. popasl id dest
  411. line.12 = result
  412. popasl id cdid
  413. line.13 = result
  414.  
  415. call setenv(CDDA_DEVICE,line.1)
  416. call setenv(CDDA_UNIT,line.2)
  417. line.0 = 13
  418. call writefile(prefs,line)
  419. exit
  420. end
  421.  
  422. if option = "CHAN" then do
  423.  address MUImp3
  424.  text id mes2
  425.  line = result
  426.  if line = "" then exit
  427.  nr = left(target,1)
  428.  target = right(target,length(target)-1)
  429.  call readfile(makepath('projects',line),file)
  430.  file.nr = target
  431.  if nr = 1 then do
  432.   linea = pathpart(file.7)
  433.   lineb = remsig(target)||".mp3"
  434.   linec = makepath(linea,lineb)
  435.   file.7 = linec
  436.  end
  437.  call writefile(makepath('projects',line),file)
  438.  exit
  439. end
  440.  
  441.  
  442.  
  443. exit
  444. remsig:
  445. parse arg rems
  446. remt = translate(rems,"_-","/~#?*||'","_")
  447. return remt
  448.  
  449. maketemp:
  450. parse arg path
  451. a = 1
  452. temp = makepath(path,'MUImp3.1.tmp')
  453. do while exists(temp)
  454. a = a + 1
  455. temp = makepath(path,'MUImp3.'a'.tmp')
  456. end
  457. call open('work',temp,'W')
  458. call close('work')
  459. return temp
  460.